package com.exam.project.business.service.impl;

import java.util.List;
import com.exam.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.exam.project.business.mapper.UserAnswerMapper;
import com.exam.project.business.domain.UserAnswer;
import com.exam.project.business.service.IUserAnswerService;

/**
 * 答案Service业务层处理
 * 
 * @author qiuwenbing
 * @date 2025-04-03
 */
@Service
public class UserAnswerServiceImpl implements IUserAnswerService 
{
    @Autowired
    private UserAnswerMapper userAnswerMapper;

    /**
     * 查询答案
     * 
     * @param id 答案主键
     * @return 答案
     */
    @Override
    public UserAnswer selectUserAnswerById(Long id)
    {
        return userAnswerMapper.selectUserAnswerById(id);
    }

    /**
     * 查询答案列表
     * 
     * @param userAnswer 答案
     * @return 答案
     */
    @Override
    public List<UserAnswer> selectUserAnswerList(UserAnswer userAnswer)
    {
        return userAnswerMapper.selectUserAnswerList(userAnswer);
    }

    /**
     * 新增答案
     * 
     * @param userAnswer 答案
     * @return 结果
     */
    @Override
    public int insertUserAnswer(UserAnswer userAnswer)
    {
        userAnswer.setCreateTime(DateUtils.getNowDate());
        return userAnswerMapper.insertUserAnswer(userAnswer);
    }

    /**
     * 修改答案
     * 
     * @param userAnswer 答案
     * @return 结果
     */
    @Override
    public int updateUserAnswer(UserAnswer userAnswer)
    {
        userAnswer.setUpdateTime(DateUtils.getNowDate());
        return userAnswerMapper.updateUserAnswer(userAnswer);
    }

    /**
     * 批量删除答案
     * 
     * @param ids 需要删除的答案主键
     * @return 结果
     */
    @Override
    public int deleteUserAnswerByIds(Long[] ids)
    {
        return userAnswerMapper.deleteUserAnswerByIds(ids);
    }

    /**
     * 删除答案信息
     * 
     * @param id 答案主键
     * @return 结果
     */
    @Override
    public int deleteUserAnswerById(Long id)
    {
        return userAnswerMapper.deleteUserAnswerById(id);
    }
}
